<template>
    <div class="container">
        <div class="content-title">上传样本</div>
        <el-upload 
            class="upload-demo" 
            drag 
            action="http://127.0.0.1:5000/uploadSample" 
            multiple
            :data="{'userId':1234, 'userName':'admin'}"
            :on-error="handleError"
            :on-success="handleSuccess">
            <el-icon class="el-icon--upload"><upload-filled /></el-icon>
            <div class="el-upload__text">
                将文件拖到此处，或
                <em>点击上传</em>
            </div>
        </el-upload>
    </div>
</template>

<script setup lang="ts">
const handleSuccess = (response, file, fileList) => {
    console.log("样本上传成功");
    console.log(response);
};
const handleError = (err, file, fileList) => {
    alert("样本上传失败");
};
</script>

<style scoped>
.content-title {
    font-weight: 400;
    line-height: 50px;
    margin: 10px 0;
    font-size: 22px;
    color: #1f2f3d;
}

.upload-demo {
    width: 100%;
}
</style>